home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 May / SGI IRIX 6.5 Complementary Applications 2004 May.iso / dist / OpenOffice.idb / usr / OpenOffice / program / soffice.z / soffice
Encoding:
Text File  |  2003-07-29  |  6.9 KB  |  270 lines

  1. #!/bin/sh
  2. #*************************************************************************
  3. #
  4. #   $RCSfile: soffice.sh,v $
  5. #
  6. #   $Revision: 1.1.2.4 $
  7. #
  8. #   last change: $Author: armin $ $Date: 2003/03/31 16:42:29 $
  9. #
  10. #   The Contents of this file are made available subject to the terms of
  11. #   either of the following licenses
  12. #
  13. #          - GNU Lesser General Public License Version 2.1
  14. #          - Sun Industry Standards Source License Version 1.1
  15. #
  16. #   Sun Microsystems Inc., October, 2000
  17. #
  18. #   GNU Lesser General Public License Version 2.1
  19. #   =============================================
  20. #   Copyright 2000 by Sun Microsystems, Inc.
  21. #   901 San Antonio Road, Palo Alto, CA 94303, USA
  22. #
  23. #   This library is free software; you can redistribute it and/or
  24. #   modify it under the terms of the GNU Lesser General Public
  25. #   License version 2.1, as published by the Free Software Foundation.
  26. #
  27. #   This library is distributed in the hope that it will be useful,
  28. #   but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  30. #   Lesser General Public License for more details.
  31. #
  32. #   You should have received a copy of the GNU Lesser General Public
  33. #   License along with this library; if not, write to the Free Software
  34. #   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  35. #   MA  02111-1307  USA
  36. #
  37. #
  38. #   Sun Industry Standards Source License Version 1.1
  39. #   =================================================
  40. #   The contents of this file are subject to the Sun Industry Standards
  41. #   Source License Version 1.1 (the "License"); You may not use this file
  42. #   except in compliance with the License. You may obtain a copy of the
  43. #   License at http://www.openoffice.org/license.html.
  44. #
  45. #   Software provided under this License is provided on an "AS IS" basis,
  46. #   WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
  47. #   WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
  48. #   MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
  49. #   See the License for the specific provisions governing your rights and
  50. #   obligations concerning the Software.
  51. #
  52. #   The Initial Developer of the Original Code is: Sun Microsystems, Inc..
  53. #
  54. #   Copyright: 2000 by Sun Microsystems, Inc.
  55. #
  56. #   All Rights Reserved.
  57. #
  58. #   Contributor(s): _______________________________________
  59. #
  60. #
  61. #
  62. #*************************************************************************
  63.  
  64. #
  65. # STAR_PROFILE_LOCKING_DISABLED=1
  66. # export STAR_PROFILE_LOCKING_DISABLED
  67. #
  68.  
  69. #
  70. # SAL_ENABLE_FILE_LOCKING=1
  71. # export SAL_ENABLE_FILE_LOCKING
  72. #
  73.  
  74. # uncomment this to remote start soffice on hostname  
  75. # SO_REMOTE_START=rsh
  76. # SO_REMOTE_APPLICATION=hostname:/fully_quallified_path/soffice
  77.  
  78. # set -x
  79.  
  80. # resolve installation directory
  81. sd_platform=`uname -s`
  82. case $sd_platform in
  83.     SCO_SV) test=/bin/test     ;;
  84.     FreeBSD) test=/bin/test     ;;
  85.       *)      test=/usr/bin/test ;;
  86. esac
  87.  
  88. sd_cwd="`pwd`"
  89. if $test -L "$0" ; then
  90.     sd_basename=`basename "$0"`
  91.      sd_script=`ls -l $0 | sed "s/.*${sd_basename} -> //g"` 
  92.      sd_sub=`echo $sd_script | cut -f1 -d/`
  93.     if [ "$sd_sub" = ".." ]; then
  94.      sd_script=`dirname $sd_script`
  95.     fi
  96.         if [ "$SO_MODE" = "" ]; then
  97.             SO_MODE="remote"
  98.         fi
  99. else
  100.     sd_script="$0"
  101. fi
  102.  
  103. userinst=`echo $0 | sed "s/\.\/\(.*\)$/\1/"`
  104. if [ `echo $userinst | sed "s/^\/.*/\//"` != "/" ]; then
  105.     userinst=$sd_cwd/$userinst
  106.     if [ "$sd_sub" = ".." ]; then
  107.         userinst=`dirname "$userinst"`
  108.     fi
  109. fi
  110. userinst=`dirname "$userinst"`
  111. if [ `basename "$userinst"` = "program" ]; then
  112.     userinst=`dirname "$userinst"`
  113. fi
  114.  
  115. cd "`dirname "$sd_script"`"
  116. sd_prog="`pwd`"
  117. if [ "$SO_MODE" = "" ]; then
  118.     SO_MODE="local";
  119. fi
  120. export SO_MODE
  121.  
  122. sd_progsub=$sd_prog/$SO_MODE
  123.  
  124. cd ..
  125. sd_binary=`basename "$0"`".bin"
  126. sd_inst="`pwd`"
  127.  
  128. # change back directory
  129. cd "$sd_cwd"
  130.  
  131. sd_fonts="$sd_inst/share/fonts"
  132.  
  133. # check if all required patches are installed
  134. if [ -x "$sd_prog/sopatchlevel.sh" ]; then
  135.     "$sd_prog/sopatchlevel.sh"
  136.     if [ $? -eq 1 ]; then
  137.         exit 0
  138.     fi
  139. fi
  140.  
  141. # set search path for shared libraries
  142. case $sd_platform in
  143.   SunOS)
  144.     LD_LIBRARY_PATH="$sd_progsub":"$sd_prog":/usr/openwin/lib:/usr/dt/lib:$LD_LIBRARY_PATH
  145.     export LD_LIBRARY_PATH
  146.     ;;
  147.  
  148.   AIX)
  149.     LIBPATH="$sd_progsub":"$sd_prog":$LIBPATH
  150.     export LIBPATH
  151.     ;;
  152.  
  153.   HP-UX)
  154.     SHLIB_PATH="$sd_progsub":"$sd_prog":/usr/openwin/lib:$SHLIB_PATH
  155.     export SHLIB_PATH
  156.     ;;
  157.  
  158.   IRIX*)
  159.     LD_LIBRARYN32_PATH=:"$sd_progsub":"$sd_prog":$LD_LIBRARYN32_PATH
  160.     export LD_LIBRARYN32_PATH
  161.     ;;
  162.  
  163.   Linux)
  164.     LD_LIBRARY_PATH="$sd_progsub":"$sd_prog":$LD_LIBRARY_PATH
  165.     export LD_LIBRARY_PATH
  166.     ;;
  167.  
  168.   *)
  169.     LD_LIBRARY_PATH="$sd_progsub":"$sd_prog":$LD_LIBRARY_PATH
  170.     export LD_LIBRARY_PATH
  171.     ;;
  172. esac
  173.  
  174. # extend the ld_library_path for java: javaldx checks the sofficerc for us
  175. java_ld_library_path=`"$sd_prog/javaldx" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"`
  176. if [ "$java_ld_library_path" != "" ] ; then
  177.     case $sd_platform in
  178.         IRIX*)
  179.             LD_LIBRARYN32_PATH=${java_ld_library_path}:${LD_LIBRARYN32_PATH}
  180.             ;;
  181.         *)
  182.             LD_LIBRARY_PATH=${java_ld_library_path}:${LD_LIBRARY_PATH}
  183.     esac
  184. fi
  185.  
  186. # set java environment variables
  187. THREADS_TYPE=native_threads
  188.  
  189. # misc. environment variables
  190. SAL_FONTPATH="$sd_fonts/75dpi:unscaled;$sd_fonts/75dpi"
  191. SAL_FONTPATH_PRIVATE="$sd_fonts/truetype;$sd_fonts/type1;$sd_fonts/serverfonts;$userinst/user/fonts"
  192. XPPATH="$sd_inst/share/xp3"
  193. MOZILLA_FIVE_HOME="$sd_inst/program"
  194.  
  195. unset XENVIRONMENT
  196.  
  197. export SAL_FONTPATH XPPATH SAL_FONTPATH_PRIVATE MOZILLA_FIVE_HOME
  198.  
  199. # uncomment line below to disable anti aliasing of fonts
  200. #SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
  201.  
  202. # error message function
  203. err () {
  204.     echo "`basename $0`: $@" 1>&2
  205.     exit 1
  206. }
  207.  
  208. #
  209. # parse command line arguments
  210. #
  211.  
  212. plugin_mode=false
  213. for DUMMY in ${1+"$@"}
  214. do
  215.     case $1 in
  216.  
  217.     ?display) 
  218.         if [ $# -lt 2 ]; then
  219.             err "$1 option requires a display name"
  220.         fi
  221.         DISPLAY=$2
  222.         export DISPLAY
  223.         shift; shift
  224.         ;;
  225.     ?plugin)
  226.  
  227.         plugin_mode=true
  228.         shift
  229.         ;;    
  230.     *)
  231.         break;
  232.         ;;
  233.     esac
  234. done
  235.  
  236. # start soffice by remote shell
  237. if [ "X${SO_REMOTE_START}" = "Xrsh" ]; then
  238.     remote_server=`echo ${SO_REMOTE_APPLICATION} | sed 's/:.*//g'`
  239.     remote_path=`echo ${SO_REMOTE_APPLICATION} | sed 's/.*://g'`
  240.     echo remote_server=\"${remote_server}\" remote_path=\"${remote_path}\"
  241.     if [ "X${DISPLAY}" = "X" ]; then
  242.         local_display=`uname -n`:0
  243.     else
  244.         local_display=${DISPLAY}
  245.     fi
  246.  
  247.     if [ "X${remote_server}" != "X" -a "X${remote_path}" != "X" ]; then
  248.         rsh ${remote_server} ${remote_path} -norsh -display ${local_display}
  249.         exit 0
  250.     else
  251.         err "invalid rsh arguments host=\"$remote_server\", command=\"${remote_path}\""
  252.     fi
  253. fi
  254.  
  255. # set path so that other apps can be started from soffice just by name
  256. PATH="$sd_prog":$PATH
  257. export PATH
  258.  
  259. # execute soffice binary
  260. # there is a bug in solaris sh that prevents the use of "$@"
  261. # because it cannot cope with spaces in directory names
  262. if [ "X${plugin_mode}" = "Xtrue" ]; then
  263.     SAL_IGNOREXERRORS=true
  264.     export SAL_IGNOREXERRORS
  265.     exec "$sd_prog/$sd_binary" -plugin "$@"
  266. else
  267.     exec "$sd_prog/$sd_binary" "$@"
  268. fi
  269.  
  270.